package com.aps.apspda.entity;

import com.aps.apspda.utils.AppUtils;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author lx
 * @date 2018/7/6
 * @desc
 */

public class InputDataEntity implements Serializable {

    private Object INPUTDATA;

    public List<InputObject> getINPUTDATA() {
        if (INPUTDATA == null) {
            return new ArrayList<>();
        } else {
            Gson gson = new Gson();
            String json = gson.toJson(INPUTDATA);
            List<InputObject> list = new ArrayList<>();
            String firstChar = json.trim().substring(0, 1);
            if (firstChar.equals("[")) {
                list = gson.fromJson(json, new TypeToken<List<InputObject>>() {
                }.getType());
            } else if (firstChar.equals("{")) {
                list.add((InputObject) gson.fromJson(json, new TypeToken<InputObject>() {
                }.getType()));
            }
            return list;
        }
    }

    public void setINPUTDATA(Object INPUTDATA) {
        this.INPUTDATA = INPUTDATA;
    }

    public static class InputObject {

        private Object EQPID;
        private Object DATACNNAME;
        private Object ISNULL;
        private Object DATAVALUE;
        private Object DATANAME;
        private Object DATATYPE;
        private Object DATATYPEDETAIL;
        private Object DATADETAIL;
        private String DATACHTITLE;
        private String DATATITLE;
        private Object LANGUAGETYPE;
        private Object SELECTVALUE;  //选项框的初始值
        private Object INPUTVALUE;  //输入框输入的值
        private int position;
        private Boolean ISFOCUS;
        private Object EQPModeType;

        public String getEQPModeType() {
            return EQPModeType == null ? "" : String.valueOf(EQPModeType);
        }

        public void setEQPModeType(Object EQPModeType) {
            this.EQPModeType = EQPModeType;
        }

        public Boolean getISFOCUS() {
            return ISFOCUS == null ? Boolean.FALSE : ISFOCUS;
        }

        public void setISFOCUS(Boolean ISFOCUS) {
            this.ISFOCUS = ISFOCUS;
        }

        public String getLANGUAGETYPE() {
            return LANGUAGETYPE == null ? "" : String.valueOf(LANGUAGETYPE);
        }

        public void setLANGUAGETYPE(Object LANGUAGETYPE) {
            this.LANGUAGETYPE = LANGUAGETYPE;
        }

        public int getPosition() {
            return position;
        }

        public void setPosition(int position) {
            this.position = position;
        }

        public String getDATACHTITLE() {
            return DATACHTITLE == null ? "" : String.valueOf(DATACHTITLE);
        }

        public void setDATACHTITLE(String DATACHTITLE) {
            this.DATACHTITLE = DATACHTITLE;
        }
        public String getSELECTVALUE() {
            return SELECTVALUE == null ? "" : String.valueOf(SELECTVALUE);
        }

        public void setSELECTVALUE(String SELECTVALUE) {
            this.SELECTVALUE = SELECTVALUE;
        }

        public String getINPUTVALUE() {
            return INPUTVALUE == null ? "" : String.valueOf(INPUTVALUE);
        }

        public void setINPUTVALUE(String INPUTVALUE) {
            this.INPUTVALUE = INPUTVALUE;
        }
        public String getDATATITLE() {
            return DATATITLE == null ? "" : String.valueOf(DATATITLE);
        }

        public void setDATATITLE(String DATATITLE) {
            this.DATATITLE = DATATITLE;
        }

        public String getDATATYPEDETAIL() {
            return DATATYPEDETAIL == null ? "" : String.valueOf(DATATYPEDETAIL);
        }

        public void setDATATYPEDETAIL(Object DATATYPEDETAIL) {
            this.DATATYPEDETAIL = DATATYPEDETAIL;
        }

        public String getDATAVALUE() {
            return AppUtils.getFormatStr(DATAVALUE);
        }

        public void setDATAVALUE(Object DATAVALUE) {
            this.DATAVALUE = DATAVALUE;
        }

        public String getDATATYPE() {
            return AppUtils.getFormatStr(DATATYPE);
        }

        public void setDATATYPE(Object DATATYPE) {
            this.DATATYPE = DATATYPE;
        }


        public String getEQPID() {
            return EQPID == null ? "" : String.valueOf(EQPID);
        }

        public void setEQPID(Object EQPID) {
            this.EQPID = EQPID;
        }

        public String getDATADETAIL() {
            return DATADETAIL == null ? "" : String.valueOf(DATADETAIL);
        }

        public void setDATADETAIL(Object DATADETAIL) {
            this.DATADETAIL = DATADETAIL;
        }

        public String getDATANAME() {
            return DATANAME == null ? "" : String.valueOf(DATANAME);
        }

        public void setDATANAME(Object DATANAME) {
            this.DATANAME = DATANAME;
        }

        public String getDATACNNAME() {
            return DATACNNAME == null ? "" : String.valueOf(DATACNNAME);
        }

        public void setDATACNNAME(Object DATACNNAME) {
            this.DATACNNAME = DATACNNAME;
        }

        public String getISNULL() {
            return ISNULL == null ? "" : String.valueOf(ISNULL);
        }

        public void setISNULL(Object ISNULL) {
            this.ISNULL = ISNULL;
        }

    }
}
